<?php 
class Test extends IController
{
   public function jwd()
   {
   	 //接值
   	$address=IReq::get("address");
   	$ak="oVYKab6alxv3fU1XWxOXWAY7X1ySSvRf";
   	$url="http://api.map.baidu.com/geocoder/v2/?address=$address&output=json&ak=$ak";
   	// print_r($url);die;
   	$data=file_get_contents($url);
   	// print_r($data);die;
   	$res=json_decode($data,true);
   	// print_r($res);die;
   	$lng=$res["result"]["location"]["lng"];//经度
   	$lat=$res["result"]["location"]["lat"];//维度
   	$arr=array("lng"=>$lng,"lat"=>$lat);
   	// print_r($arr);die;
   	//实例化
   	$model=new IModel("jwd");
   	//处理数据
   	$model->setData($arr);
   	$res=$model->add();
   	echo json_encode($arr);
   }
   public function qqlogin()
   {
      $this->redirect("qqlogin");
   }
   public function qq()
   {
      header("content-type:text/html;charset=utf8");
      $appid='101353491';        // appid
      $appkey='df4e46ba7da52f787c6e3336d30526e4';        // APPKEY
      $redirect_uri='http://www.iwebshop.com/index.php';    // 回调地址
      $state=rand(1000,9999);
      $url="https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=$appid&redirect_uri=$redirect_uri&state=$state";
      // print_r($url);die;
      header("location:$url");
   }
}
 ?>
